package Week3.num.week3Test1.Level4_Project8;

public final class Utils {

    private static Utils utils = new Utils();
    private Utils(){}

    public static Utils getInstance(){
        return utils;
    }

    public static int addition(int a){
        int result=0;
        for (int i = 1; i <=a ; i++) {
            result=result+i;
        }
        return result;
    }
    public static int multip(int a){
        int result=1;
        for (int i = 1; i <= a; i++) {
            result=result*i;
        }
        return result;
    }
    public static int[] bubbling(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if (arr[j] > arr[j+1]) {
                    int temp=arr[j];
                    arr[j]=arr[i];
                    arr[i]=temp;
                }
            }
        }
        return arr;
    }
    public static boolean ifEven(int num){
        return num%2==0;
    }

}
